<!-- $Id: agency_list.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{if $full_page}

{include file="pageheader.htm"}

{insert_scripts files="../js/utils.js,listtable.js,../js/region.js"}
<script language="javascript" type="text/javascript" src="../js/DatePicker/WdatePicker.js"></script>
<div class="form-div">
  <form action="javascript:search_supp()" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
    商家： <input type="text" name="suppliers_name" size="15" />
    结算单号： <input type="text" name="settlement_sn" size="15" />  
    结算状态：
    <select name="settlement_status">
    <option value="">请选择</option>
    {html_options options=$lang.account_settlement_status selected=$filter.status }  
    </select> 
    结算订单起止日期：<input class="Wdate" type="text" name="start_time" readonly onfocus="WdatePicker({dateFmt:'yyyy-M-d HH:mm',maxDate:'%y-%M-%d HH:mm'})"/>
      ~      
      <input class="Wdate" type="text" name="end_time" readonly onfocus="WdatePicker({dateFmt:'yyyy-M-d HH:mm',maxDate:'%y-%M-%d HH:mm'})"/>  
    <input type="submit" value="{$lang.button_search}" class="button" />
  </form>
</div>
<form method="post" action="" name="listForm" onsubmit="return confirm(batch_drop_confirm);">
<div class="list-div" id="listDiv">
{/if}
  <table cellpadding="3" cellspacing="1">
    <tr>
      <th> <input onclick='listTable.selectAll(this, "checkboxes")' type="checkbox" />
          <a href="javascript:listTable.sort('id'); ">{$lang.record_id}</a>{$sort_id} </th>
      <th>结算单号</th>
      <th><a href="javascript:listTable.sort('suppliers_name'); ">{$lang.suppliers_name}</a>{$sort_suppliers_name}</th>
      <th>总金额</th>
      <th>佣金</th>
      <th>分销</th>
      <th>实结金额</th>
      <!-- 
      <th>结算起止时间</th>  -->
      <th>结算时间</th>
      <th>状态</th>  
      <!-- 
      <th>商家反馈</th> 
       -->
      <th>{$lang.handler}</th>
    </tr>

    {foreach from=$suppliers_accounts_list item=item}
    <tr>
      <td align="center"><input type="checkbox" name="checkboxes[]" value="{$item.id}" />
        {$item.id}</td>
      <td align="center">{if $item.settlement_status eq 5}<span style="color:#F00">{$item.settlement_sn}</span>{else}{$item.settlement_sn}{/if}</td>  
      <td align="center" class="first-cell"><span>{$item.suppliers_name|escape:html}</span></td> 
      <td align="center">{$item.total}</td>
      <td align="center">{$item.commission}</td>
      <td align="center">{$item.fenxiao_money}</td>
      <td align="center">{$item.settlement_amount}</td>
      <!-- 
      <td align="center">{$item.money}</td>
      <td align="center" >{$item.start_time}<br />{$item.end_time}</td> 
      -->
      <td align="center" >{$item.add_time}</td> 
      <td align="center" >{$lang.account_settlement_status[$item.settlement_status]}</td> 
     <!--  
      <td align="center" >{$item.remark}</td> 
      -->
      <td align="center" class="bnt_a">
      <!-- 
      {if $item.settlement_status eq 1 or $item.settlement_status eq 5}{$lang.account_settlement_status[$settlement_status]}{/if}        

{if $item.settlement_status eq 1 or $item.settlement_status eq 5}待审核{/if}        
{if $item.settlement_status eq 2}<a onclick="if(confirm('是否确认付款'))  return true; else return false;" href="suppliers.php?act=pay&id={$item.id}&suppliers_id={$item.suppliers_id}&page={$filter.page}" title="">付款</a>{/if}
{if $item.settlement_status eq 3}已付款待确认{/if}
{if $item.settlement_status eq 4}已完成{/if} | -->
<a  href="suppliers.php?act=detail&suppliers_accounts_id={$item.id}" title="">明细</a>

</td>
    </tr>

    {foreachelse}

    <tr><td class="no-records" colspan="8">{$lang.no_records}</td></tr>

    {/foreach}

  </table>

<table id="page-table" cellspacing="0">

  <tr>

    <td>
<!-- 
      <input name="remove" type="submit" id="btnSubmit" value="{$lang.drop}" class="button" disabled="true" />

      <input name="act" type="hidden" value="batch" />
 -->
    </td>

    <td align="right" nowrap="true">

    {include file="page.htm"}

    </td>

  </tr>

</table>



{if $full_page}

</div>

</form>


<script language="JavaScript">
    function search_supp()
    {
        listTable.filter['suppliers_name'] = Utils.trim(document.forms['searchForm'].elements['suppliers_name'].value);
		listTable.filter['settlement_sn'] = Utils.trim(document.forms['searchForm'].elements['settlement_sn'].value);
		listTable.filter['settlement_status'] = Utils.trim(document.forms['searchForm'].elements['settlement_status'].value);
		listTable.filter['start_time'] = Utils.trim(document.forms['searchForm'].elements['start_time'].value);
		listTable.filter['end_time'] = Utils.trim(document.forms['searchForm'].elements['end_time'].value);

		listTable.filter['page'] = 1;		
        listTable.loadList();
        getDownUrl();
    }
    function getDownUrl()
    {
      var aTags = document.getElementsByTagName('A');
      for (var i = 0; i < aTags.length; i++)
      { 
        if (aTags[i].href.indexOf('download') >= 0)
        {		
	    	suppliers_name = document.forms['searchForm'].elements['suppliers_name'].value;
	       	settlement_sn= document.forms['searchForm'].elements['settlement_sn'].value;
	       	settlement_status = document.forms['searchForm'].elements['settlement_status'].value;             
	       	start_time = document.forms['searchForm'].elements['start_time'].value;
	       	end_time = document.forms['searchForm'].elements['end_time'].value;
            page = 1;
            str="suppliers_name="+suppliers_name+"&settlement_sn="+settlement_sn+"&settlement_status="+settlement_status+
            "&start_time="+start_time+"&end_time="+end_time+"&page="+page;
            aTags[i].href = "suppliers.php?act=account_download&"+str;
            
        }
        if (aTags[i].href.indexOf('print') >= 0)
        {		
	    	suppliers_name = document.forms['searchForm'].elements['suppliers_name'].value;
	       	settlement_sn= document.forms['searchForm'].elements['settlement_sn'].value;
	       	settlement_status = document.forms['searchForm'].elements['settlement_status'].value;             
	       	start_time = document.forms['searchForm'].elements['start_time'].value;
	       	end_time = document.forms['searchForm'].elements['end_time'].value;
            page = 1;
            str="suppliers_name="+suppliers_name+"&settlement_sn="+settlement_sn+"&settlement_status="+settlement_status+
            "&start_time="+start_time+"&end_time="+end_time+"&page="+page;
            aTags[i].href = "suppliers.php?act=account_print&"+str;
            aTags[i].target="_blank";
        }
      }
    }
</script>

<script type="text/javascript" language="javascript">

region.isAdmin = true;

  <!--

  listTable.recordCount = {$record_count};

  listTable.pageCount = {$page_count};

  listTable.query = "accounts_query";

  {foreach from=$filter item=item key=key}

  listTable.filter.{$key} = '{$item}';

  {/foreach}

  {literal}

  onload = function()

  {

      // 开始检查订单

      startCheckOrder();
      getDownUrl();

  }

  {/literal}

  //-->

</script>

{include file="pagefooter.htm"}

{/if}